package com.cxy.view.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.Objects;

@Mapper
@Component  // idea高版本不会警告错误，可省略
public interface ViewMapper {
    @Select("select * from job_area")
    List<Map<String, Objects>> getAreaData();
    @Select("select * from job_sal_range")
    List<Map<String, Objects>> getSalRangeData();

    @Select("select ind_name, value from job_instry where job_key = '大数据' order by value desc limit 7")
    List<Map<String, Objects>> getIndustryData();

    @Select("select job_name,count,(select sum(count) from job_item2) total from job_item2 limit 6;")
    List<Map<String, Objects>> getJobItemData();

    @Select("select day date, count, month type from job_mchange where month in ('12','01');")
    List<Map<String, Object>> getJobMChange();

    @Select("select date,type,count from job_supplier_demander where substr(date,1,4) in('2022','2023')")
    List<Map<String, Object>> getJobSupplierDemanderData();

    //大屏二
    @Select("select type_name,movie_count from movie_type")
    List<Map<String, Objects>> getMovieTypeData();

    @Select("SELECT SUM(total_boxoffice) AS total FROM movie_boxoffice")
    Double sumTotalBoxoffice(); // 直接返回数值

    @Select("SELECT SUM(today_boxoffice) AS today FROM movie_boxoffice")
    Double sumTodayBoxoffice();

    @Select("SELECT SUM(total_tickets) AS total FROM movie_tickets")
    Double sumTotalTickets();

    @Select("SELECT SUM(today_tickets) AS today FROM movie_tickets")
    Double sumTodayTickets();

    @Select("SELECT age_range AS name, audience_count AS value FROM audience_age_distribution")
    List<Map<String, Objects>> getAgeData();
    @Select("select * from cinema_info")
    List<Map<String, Objects>> getCinemaData();

    @Select("SELECT movie_name, box_office FROM hot_movie_box_office ORDER BY box_office DESC LIMIT 5")
    List<Map<String, Objects>> getHotMovieBoxOffice();

    @Select("SELECT box_office_this_week AS thisWeek, box_office_last_week AS lastWeek " +
            "FROM box_office_trend " +
            "ORDER BY FIELD(week_day, '周一', '周二', '周三', '周四', '周五', '周六', '周日')")
    List<Map<String, Objects>> getBoxOfficeTrend();

    @Select("SELECT province_name AS name, box_office AS value FROM hot_area_box_office")
    List<Map<String, Objects>> getHotAreaBoxOffice();
}




